#pragma once
#include <QFile>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QObject>
#include "TileKey.h"
#include <QUrl>
#include<QMap>
#include <memory>
class MyTileSources;

class HttpLoader: public QObject 
{
	Q_OBJECT
		QFile *m_file;
	bool m_isReady;
public:
	HttpLoader(QObject *parent = 0);// : QObject(parent);
	virtual ~HttpLoader();
	void SetTileSource(MyTileSources* tilesoure);
	void downloadFileFromURL(const QString &url, const QString &filePath);
signals:
	void sig_ReturResult(HttpLoader *loader, QString& path);
	void sig_test();
private slots:
	void onDownloadFileComplete(QNetworkReply *reply);

private:
	MyTileSources * m_source;
	QString m_strPath;
	std::shared_ptr<QNetworkAccessManager>  m_pmanager;
	QNetworkAccessManager * pmanager ;
public:
	TileKey m_tilekey;
};

